home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Draw / CBitmapStripManager.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  4.0 KB  |  141 lines

  1.  
  2. {
  3.    if(true)
  4.    {
  5.       CBitmapStripManager = ┬º┬ºnewclass(CBitmapStripManager,CBitmapStripPlane);
  6.    }
  7. }
  8.  
  9. package Local.Draw
  10. {
  11.    import Local.Game.Level.*;
  12.    import STC9.System.CProfiler;
  13.    import flash.display.*;
  14.    import flash.events.*;
  15.    import flash.geom.*;
  16.    
  17.    public class CBitmapStripManager extends CBitmapStripPlane
  18.    {
  19.       
  20.       public static var mFilters:Array;
  21.        
  22.       
  23.       internal var _Position:Point;
  24.       
  25.       public function CBitmapStripManager()
  26.       {
  27.          super(2,2);
  28.          mStrips = new Object();
  29.          _Position = new Point();
  30.          mFilters = new Terrain_Filter().mcFilter.filters;
  31.          AddStrips(new CBitmapStrips("ground",new CLevelData.mcTerrainGround(),1,false,false,false));
  32.          AddStrips(new CBitmapStrips("decor",new CLevelData.mcTerrainGroundDecor(),1,false,false,true));
  33.          AddStrips(new CBitmapStrips("near",new CLevelData.mcTerrainNear(),0.5,false,true,true));
  34.          AddStrips(new CBitmapStrips("far",new CLevelData.mcTerrainFar(),0.25,false,true,true));
  35.          AddStrips(new CBitmapStrips("sky",new CLevelData.mcTerrainSky(),0.1,true,true,false));
  36.          CProfiler.AddDebug("mem strips",String(Math.ceil(mMemSize / 1000)) + "kb");
  37.       }
  38.       
  39.       public function set mPosition(param1:Point) : void
  40.       {
  41.          _Position.x = param1.x;
  42.          _Position.y = param1.y;
  43.          ValidatePosition();
  44.       }
  45.       
  46.       public function Scroll(param1:Number = 0, param2:Number = 0) : void
  47.       {
  48.          if(true)
  49.          {
  50.             mPosition = new Point(_Position.x + param1,_Position.y + param2);
  51.          }
  52.       }
  53.       
  54.       public function get mMemSize() : uint
  55.       {
  56.          var _loc1_:* = 0;
  57.          var _loc2_:CBitmapStrips = null;
  58.          _loc1_ = 0;
  59.          for each(_loc2_ in mStrips)
  60.          {
  61.             ┬º┬ºpush(_loc1_);
  62.             if(true)
  63.             {
  64.                ┬º┬ºpush(uint(┬º┬ºpop() + _loc2_.mMemSize));
  65.             }
  66.             _loc1_ = ┬º┬ºpop();
  67.          }
  68.          return _loc1_;
  69.       }
  70.       
  71.       public function Process() : void
  72.       {
  73.          mStrips["sky"].mOffsetX += 11;
  74.       }
  75.       
  76.       public function get mFineAltitudes() : Array
  77.       {
  78.          return mStrips["ground"].mFineAltitudes;
  79.       }
  80.       
  81.       private function ValidatePosition() : void
  82.       {
  83.          var _loc1_:CBitmapStrips = null;
  84.          if(_Position.x < 0)
  85.          {
  86.             _Position.x = 0;
  87.          }
  88.          else if(_Position.x > mStrips["ground"].mSize.x - mBMD.width)
  89.          {
  90.             _Position.x = mStrips["ground"].mSize.x - mBMD.width;
  91.          }
  92.          for each(_loc1_ in mStrips)
  93.          {
  94.             _loc1_.UpdatePosition(_Position);
  95.          }
  96.       }
  97.       
  98.       public function get mAltitudes() : Array
  99.       {
  100.          return mStrips["ground"].mAltitudes;
  101.       }
  102.       
  103.       public function StartRender() : void
  104.       {
  105.          CProfiler.StartProfile("Strip.StartRender");
  106.          Clear();
  107.          StackStrips(mStrips["ground"]);
  108.          StackStrips(mStrips["decor"]);
  109.          StackStrips(mStrips["near"]);
  110.          StackStrips(mStrips["far"]);
  111.          StackStrips(mStrips["sky"]);
  112.          CProfiler.StopProfile("Strip.StartRender");
  113.       }
  114.       
  115.       public function get mPosition() : Point
  116.       {
  117.          return _Position;
  118.       }
  119.       
  120.       public function EndRender() : void
  121.       {
  122.          CProfiler.StartProfile("Strip.EndRender");
  123.          RenderStacks(["ground"]);
  124.          CProfiler.StopProfile("Strip.EndRender");
  125.       }
  126.       
  127.       public function AddStrips(param1:CBitmapStrips) : void
  128.       {
  129.          mStrips[param1.mName] = param1;
  130.          mDrawStacks[param1.mName] = new Array();
  131.       }
  132.       
  133.       public function Render() : void
  134.       {
  135.          CProfiler.StartProfile("Strip.Render");
  136.          RenderStacks(["sky","far","near","decor"]);
  137.          CProfiler.StopProfile("Strip.Render");
  138.       }
  139.    }
  140. }
  141.